<template>
  <div>
    <el-select
      clearable
      placeholder="请选择题库"
      :modelValue="modelValue"
      @change="onChange"
    >
      <el-option
        :key="item.bankId"
        :value="item.bankId"
        :label="item.bankName"
        v-for="item in bankList"
      ></el-option>
    </el-select>
  </div>
</template>

<script setup>
import { ref, reactive, getCurrentInstance, nextTick } from "vue";
const { proxy } = getCurrentInstance();

const props = defineProps({
  modelValue: {
    type: Number,
  },
});

const api = {
  loadBankList: "/bankList/loadAllBank4Select",
};
const bankList = ref([]);
const loadBankList = async () => {
  let result = await proxy.Request({
    url: api.loadBankList,
    params: {
      type: props.type,
    },
  });
  if (!result) {
    return;
  }
  bankList.value = result.data;
};

loadBankList();

const emit = defineEmits(["update:modelValue", "change"]);
const onChange = (e) => {
  emit("update:modelValue", e);
  emit("change");
};
</script>

<style lang="scss" scoped>
</style>
